package com.yanqu.road.server.cmd.activity.newyearbag;

import com.yanqu.road.message.YanQuMessage;
import com.yanqu.road.pb.activity.NewYearBagProto;
import com.yanqu.road.server.cmd.CrossCommand;
import com.yanqu.road.server.command.Cmd;
import com.yanqu.road.server.manager.activity.newyearbag.CrossNewYearBagActivity;
import com.yanqu.road.server.manager.activity.newyearbag.CrossNewYearBagMgr;
import com.yanqu.road.server.protocol.CrossProtocol;

@Cmd(code = CrossProtocol.C2_NEW_YEAR_BAG_OPEN, desc = "")
public class CrossNewYearBagOpenCmd extends CrossCommand {

    @Override
    public boolean parseData(YanQuMessage packet) throws Exception {
        NewYearBagProto.CrossNewYearBagOpenReqMsg reqMsg = NewYearBagProto.CrossNewYearBagOpenReqMsg.parseFrom(packet.getBytes());
        CrossNewYearBagActivity activity = CrossNewYearBagMgr.getActivity(reqMsg.getActivityId());
        if (activity != null) {
            activity.openByCmd(serverId, packet.getPlayerId(), reqMsg);
        } else {
            log.info("activity no found {}.", reqMsg.getActivityId());
        }
        return true;
    }

    @Override
    public void execute(YanQuMessage packet) throws Exception {

    }

    @Override
    public void sendData() {

    }
}
